import Vue from 'vue'
import Router from 'vue-router'
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const Home = () => import('@/view/index/home')
const Login = () => import('@/view/index/login')
const Entirety = () => import('@/view/index/entirety')
const My = () => import('@/view/index/my')

const SaleOrder  = () => import('@/view/index/saleOrder') 
const PointReportDay  = () => import('@/view/index/pointReportDay') 
const CouponOrder  = () => import('@/view/index/couponOrder') 
const CouponReportDay  = () => import('@/view/index/couponReportDay') 

const Setting = () => import('@/view/index/Setting') 
const ChangePassword = () => import('@/view/index/changePassword')
const AboutUs = () => import('@/view/index/aboutUs') 



Vue.use(Router)
const router = new Router({
  mode: 'history',
  base: process.env.Base_Str,
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
      redirect:'/entirety', // 设置默认打开的页面
      children:[
        {
          path: '/entirety',
          name: 'Entirety',
          component: Entirety,
          meta: { title: '数据概览', keepAlive:true }
        },
        {
          path: '/my',
          name: 'My',
          component: My,
          meta: { title: '我的' } 
        }, 

      ]
    },
    {
      path: '/saleOrder',
      name: 'SaleOrder',
      component: SaleOrder,
      meta: { title: '兑换订单' }
    },
    {
      path: '/pointReportDay',
      name: 'PointReportDay',
      component: PointReportDay,
      meta: { title: '兑换日统计' }
    },
    {
      path: '/couponOrder',
      name: 'CouponOrder',
      component: CouponOrder,
      meta: { title: '赠券订单' }
    },
    {
      path: '/couponReportDay',
      name: 'CouponReportDay',
      component: CouponReportDay,
      meta: { title: '赠券日统计' }
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
      meta: { title: '登录' }
    },
    {
      path: '/setting',
      name: 'Setting',
      component: Setting,
      meta: { title: '设置' }
    },
    
    {
      path: '/changePassword',
      name: 'ChangePassword',
      component: ChangePassword,
      meta: { title: '修改密码' }
    },
    {
      path: '/aboutUs',
      name: 'AboutUs',
      component: AboutUs,
      meta: { title: '关于我们' }
    },
    /*{
      path: '/shopBigSaleOrderDetail',
      name: 'ShopBigSaleOrderDetail',
      component: ShopBigSaleOrderDetail,
      meta: { title: '商城订单详情' }
    },
    {
      path: '/shopBigSaleOrder',
      name: 'ShopBigSaleOrder',
      component: ShopBigSaleOrder,
      meta: { title: '商城订单' }
    },
    {
      path: '/shopBigDetail',
      name: 'ShopBigDetail',
      component: ShopBigDetail,
      meta: { title: '商城店铺详情' }
    },
    {
      path: '/shopBigList',
      name: 'ShopBigList',
      component: ShopBigList,
      meta: { title: '商城店铺' }
    },

    {
      path: '/stockIndex',
      name: 'StockIndex',
      component: StockIndex,
      meta: { title: '库存' }
    },
   
    {
      path: '/wareRecoredList',
      name: 'WareRecoredList',
      component: WareRecoredList,
      meta: { title: '补货记录' }
    },
    
    {
      path: '/saleDayChart',
      name: 'SaleDayChart',
      component: SaleDayChart,
      meta: { title: '销售渠道日报' }
    },
    {
      path: '/shopSalePoolData',
      name: 'ShopSalePoolData',
      component: ShopSalePoolData,
      meta: { title: '渠道销售汇总' }
    },
    {
      path: '/shopDatePoolData',
      name: 'ShopDatePoolData',
      component: ShopDatePoolData,
      meta: { title: '日期渠道汇总' }
    },
    {
      path: '/wareRecoredDetail',
      name: 'WareRecoredDetail',
      component: WareRecoredDetail,
      meta: { title: '补货详情' }
    },
    
    {
      path: '/saleRank',
      name: 'SaleRank',
      component: SaleRank,
      meta: { title: '渠道销售排行' }
    },
    
    {
      path: '/stockList',
      name: 'StockList',
      component: StockList,
      meta: { title: '库存列表' }
    },
    {
      path: '/purchaseTip',
      name: 'PurchaseTip',
      component: PurchaseTip,
      meta: { title: '可以进货店铺数据' }
    },
    
    {
      path: '/winningRecord',
      name: 'WinningRecord',
      component: WinningRecord,
      meta: { title: '登录' }
    },
    
   
    {
      path: '/moreList',
      name: 'MoreList',
      component: MoreList,
      meta: { title: '销售明细' }
    },
    
    {
      path: '/messageList',
      name: 'MessageList',
      component: MessageList,
      meta: { title: '我的消息' }
    },
    {
      path: '/messageDetail',
      name: 'MessageDetail',
      component: MessageDetail,
      meta: { title: '消息详情' }
    },
    {
      path: '/myShops',
      name: 'MyShops',
      component: MyShops,
      meta: { title: '消息详情' }
    },
   
  
    {
      path: '/shopMng',
      name: 'ShopMng',
      component: ShopMng,
      meta: { title: '店铺列表' }
    },
  
    {
      path: '/shopDetail',
      name: 'ShopDetail',
      component: ShopDetail,
      meta: { title: '店铺详情' }
    }, 
   
    {
      path: '/hlep',
      name: 'Hlep',
      component: Hlep,
      meta: { title: '帮助' }
    },*/
    
  ],
  
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0}
  }
})


export default router;